﻿<?php
session_start();
include 'interface.php';
include 'dbconnect.php';
$dbcnx = dbconnect();
$news_id = $_GET["news_id"]; 
$comm = $_POST["comm"]; 

$aut_id = $_SESSION['id'];

$query = "INSERT INTO `newsdb`.`comments` (`news_id`, `author_id`, `text`, `date`) 
			VALUES (\"$news_id\", \"$aut_id\", \"$comm\", NOW())";
$t = mysql_query($query); 
if (!$t )
  {
    //die('Беда=( ' .mysql_error());
  }

echo "<html>";
echo "<title>";
  echo "Чатик - заявка отправлена";
echo "</title>";
echo "<body>";

    echo "<table width = \"100%\" bordercolor = \"green\"><!-- \"#5a009c\" -->";
        drawHeader();
    echo "<tr>";
        echo "<td></td>";
        echo "<td colspan = \"2\" rowspan = \"2\">";
        
        echo "Спасибо за комментарии! ";
        $ref = sprintf("news_view.php?id=%d", $news_id);
        echo "<a href = ";
        echo $ref;
        echo ">Назад</a>";

        echo "</td>";        
        echo "</tr>";
    echo "</table>";   
echo "</body>";	
echo "</html>";
?>

